home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / modules / nessus-2.2.8.mo / usr / lib / nessus / plugins / sahagent_detection.nasl < prev    next >
Text File  |  2005-01-14  |  5KB  |  135 lines

  1. #
  2. # Copyright (C) 2004 Tenable Network Security 
  3. #
  4. #
  5.  
  6. if(description)
  7. {
  8.  script_id(12000);
  9.  script_version("$Revision: 1.5 $");
  10.  
  11.  name["english"] = "SAHAGENT detection";
  12.  
  13.  script_name(english:name["english"]);
  14.  
  15.  desc["english"] = "
  16. The remote host is using the SAHAGENT program.  
  17. You should ensure that:
  18. - the user intended to install SAHAGENT (it is sometimes silently installed)
  19. - the use of SAHAGENT matches your Corporate mandates and Security Policies.
  20.  
  21. To remove this sort of software, you may wish to check out ad-aware or spybot. 
  22.  
  23. See also : http://www.safersite.com/PestInfo/s/sahagent.asp 
  24.  
  25. Solution : Uninstall this software
  26. Risk factor : High";
  27.  
  28.  
  29.  
  30.  script_description(english:desc["english"]);
  31.  
  32.  summary["english"] = "SAHAGENT detection";
  33.  
  34.  script_summary(english:summary["english"]);
  35.  
  36.  script_category(ACT_GATHER_INFO);
  37.  
  38.  script_copyright(english:"This script is Copyright (C) 2004 Tenable Network Security");
  39.  family["english"] = "Windows";
  40.  script_family(english:family["english"]);
  41.  
  42.  script_dependencies( "smb_registry_full_access.nasl");
  43.  script_require_keys("SMB/registry_full_access");
  44.  
  45.  script_require_ports(139, 445);
  46.  exit(0);
  47. }
  48.  
  49.  
  50. # start the script
  51. if ( ! get_kb_item("SMB/registry_full_access") ) exit(0);
  52.  
  53. path[0] = "software\classes\clsid\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  54. path[1] = "software\classes\interface\{4828c95f-c5db-4ab6-a945-8d8ec44b98a8}";
  55. path[2] = "software\classes\interface\{4e570f74-deee-4fcf-b960-feefa4b8c6fc}";
  56. path[3] = "software\microsoft\code store database\distribution units\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  57. path[4] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/lsp_.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  58. path[5] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/sahagent_.exe\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  59. path[6] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/sahdownloader_.exe\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  60. path[7] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/sahuninstall_.exe\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  61. path[8] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/sporder_.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  62. path[9] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/webinstaller.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  63. path[10] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/xmlparse_.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  64. path[11] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/downloaded program files/xmltok_.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  65. path[12] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/system32/mfc42.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  66. path[13] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/system32/msvcrt.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  67. path[14] = "software\microsoft\windows\currentversion\moduleusage\c:/winnt/system32/olepro32.dll\{30402ff4-3e71-4a1c-9b4b-1cd3486a9fb2}";
  68. path[15] = "software\microsoft\windows\currentversion\run\sahagent";
  69. path[16] = "software\vgroup";
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. global_var handle;
  77.  
  78. include("smb_nt.inc");
  79. x_name = kb_smb_name();
  80. if(!x_name)exit(0);
  81.  
  82. _smb_port = kb_smb_transport();
  83. if(!_smb_port)exit(0);
  84.  
  85. if(!get_port_state(_smb_port)) exit(0);
  86. login = kb_smb_login();
  87. pass  = kb_smb_password();
  88. domain = kb_smb_domain();
  89.  
  90. if(!login)login = "";
  91. if(!pass) pass = "";
  92.  
  93.           
  94. soc = open_sock_tcp(_smb_port);
  95. if(!soc) exit(0);
  96.  
  97. #
  98. # Request the session
  99. r = smb_session_request(soc:soc,  remote:x_name);
  100. if(!r) { close(soc); exit(0); }
  101.  
  102. #
  103. # Negociate the protocol
  104. #
  105. prot = smb_neg_prot(soc:soc);
  106. if(!prot){ close(soc); exit(0); }
  107.  
  108.  
  109. r = smb_session_setup(soc:soc, login:login, password:pass, domain:domain, prot:prot);
  110. if(!r){ close(soc); exit(0); }
  111. uid = session_extract_uid(reply:r);
  112.  
  113. r = smb_tconx(soc:soc, name:x_name, uid:uid, share:"IPC$");
  114. tid = tconx_extract_tid(reply:r);
  115. if(!tid){ close(soc); exit(0); }
  116.  
  117.  
  118. r = smbntcreatex(soc:soc, uid:uid, tid:tid, name:"\winreg");
  119. if(!r){ close(soc); exit(0);}
  120. pipe = smbntcreatex_extract_pipe(reply:r);
  121.  
  122. r = pipe_accessible_registry(soc:soc, uid:uid, tid:tid, pipe:pipe);
  123. if(!r){ close(soc); exit(0); }
  124. handle = registry_open_hklm(soc:soc, uid:uid, tid:tid, pipe:pipe);
  125. if ( ! handle ) exit(0);
  126.  
  127.  
  128. for (i=0; path[i]; i++) {
  129.        key_h = registry_get_key(soc:soc, uid:uid, tid:tid, pipe:pipe, key:path[i], reply:handle);
  130.        if(key_h != NULL) {security_hole(kb_smb_transport()); exit(0); }
  131. }
  132.  
  133. close(soc);
  134.